package com.zhentao.entity.order;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("order_goods")
public class OrderGoods { // 直接使用数据库实体类，添加Excel注解
    @ExcelProperty(index = 0, value = "ID")
    @ColumnWidth(10)
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ExcelProperty(index = 1, value = "订单编号")
    @ColumnWidth(15)
    private Integer orderId;

    @ExcelProperty(index = 2, value = "商品ID")
    @ColumnWidth(15)
    private Integer goodsId;

    @ExcelProperty(index = 3, value = "商品名称")
    @ColumnWidth(20)
    private String goodsName;

    @ExcelProperty(index = 4, value = "商品单价(元)")
    @ColumnWidth(15)
    private Integer goodsPrice;

    @ExcelProperty(index = 5, value = "购买数量")
    @ColumnWidth(10)
    private Integer quantity;

    @ExcelProperty(index = 6, value = "小计金额(元)")
    @ColumnWidth(15)
    private Integer subtotal;

    @ExcelProperty(index = 7, value = "创建时间")
    @DateTimeFormat("yyyy-MM-dd HH:mm:ss")
    @ColumnWidth(20)
    private Date createTime;

    // 新增的三个字段
    @ExcelProperty(index = 8, value = "下单人")
    @ColumnWidth(15)
    private String orderPerson;

    @ExcelProperty(index = 9, value = "收货人")
    @ColumnWidth(15)
    private String consignee;

    @ExcelProperty(index = 10, value = "订单状态")
    @ColumnWidth(15)
    private String orderStatus;
}